package com.ny.service.impl;

import com.ny.entity.Reservations;
import com.ny.mapper.ReservationMapper;
import com.ny.service.ReservationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class ReservationServiceImpl implements ReservationService {
    @Autowired
    private ReservationMapper reservationMapper;
    @Override
    public void addReservation(Reservations reservation) {
        reservationMapper.addReservation(reservation);
    }
    @Override
    public List<Reservations> findAllReservations() {
        return reservationMapper.findAllReservations();
    }
    public void updateReservationStatus(int reservationId, String status, String rejectReason) {
        reservationMapper.updateReservationStatus(reservationId, status, rejectReason);
    }

    @Override
    public List<Reservations> findUserReservations(int userId) {
        return reservationMapper.findUserReservations(userId);
    }
    @Override
    public List<Reservations> findReservations(String username, String classroomName, Date startDatetime, Date endDatetime, String status) {
        return reservationMapper.findReservations(username, classroomName, startDatetime, endDatetime, status);
    }
}
